package io.renren.modules.back.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;
import io.renren.common.utils.StringUtil;
import io.renren.modules.back.dao.AdPositionDao;
import io.renren.modules.back.entity.AdPositionEntity;
import io.renren.modules.back.service.AdPositionService;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * 广告位Service接口实现类
 *
 * @author zzh
 * @email 862583291@qq.com
 * @date 2019年5月11日 上午15:28:55
 */
@Service("adPositionService")
public class AdPositionServiceImpl extends ServiceImpl<AdPositionDao, AdPositionEntity> implements AdPositionService {
    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        String name = (String)params.get("name");
        Page<AdPositionEntity> page = (Page<AdPositionEntity>) this.page(
                new Query<AdPositionEntity>(params).getPage(),
                new QueryWrapper<AdPositionEntity>().like(StringUtils.isNotBlank(name),"name", name)
        );
        return new PageUtils(page);
    }
}
